package com.android.tnovoselec.travelassistant.dto;

import java.util.ArrayList;
import java.util.List;

import com.j256.ormlite.field.DataType;
import com.j256.ormlite.field.DatabaseField;
import com.j256.ormlite.table.DatabaseTable;
import com.nth.android.favorites.entity.ValidEntity;

/**
 * Title: Android Framework - Favorites <br />
 * <br />
 * Copyright: Copyright (c) 2011 <br />
 * <br />
 * NTH Company: NTH d.o.o. <br />
 * <br />
 * 
 * MeteoFavoritesDto is object used to bind weather situation with given
 * location. It usually have one or more forecast objects.
 * 
 * @author Tomislav Novoselec
 * @version 1.0.0
 * @since 1.0.0
 * 
 */

@DatabaseTable(tableName = "meteo")
public class MeteoFavoritesDto extends ValidEntity {

	@DatabaseField(id = true, canBeNull = false, dataType = DataType.INTEGER)
	private Integer id = null;

	@DatabaseField(canBeNull = false, dataType = DataType.STRING)
	private String cityId;

	@DatabaseField(canBeNull = true, dataType = DataType.STRING)
	private String title;

	@DatabaseField(canBeNull = true, dataType = DataType.STRING)
	private String url;

	@DatabaseField(canBeNull = true, dataType = DataType.DOUBLE)
	private double lat;

	@DatabaseField(canBeNull = true, dataType = DataType.DOUBLE)
	private double lng;

	@DatabaseField(canBeNull = false, dataType = DataType.INTEGER)
	private Integer position;

	@DatabaseField(canBeNull = false, dataType = DataType.BOOLEAN, defaultValue = "false")
	private Boolean visible = true;

	@DatabaseField(canBeNull = true, dataType = DataType.STRING)
	private String conditionString;

	@DatabaseField(canBeNull = false, dataType = DataType.INTEGER)
	private Integer temperature;

	@DatabaseField(canBeNull = true, dataType = DataType.STRING)
	private String humidity;

	@DatabaseField(canBeNull = true, dataType = DataType.STRING)
	private String iconUrl;

	@DatabaseField(canBeNull = true, dataType = DataType.STRING)
	private String windDirection;

	@DatabaseField(canBeNull = false, dataType = DataType.INTEGER)
	private Integer windSpeed;

	@DatabaseField(canBeNull = true, dataType = DataType.STRING)
	private String windSpeedUnit;

	@DatabaseField(canBeNull = true, dataType = DataType.STRING)
	private String backgroundImageUrl;

	private List<ForecastFavoritesDto> forecast;

	public MeteoFavoritesDto() {
		super();
		this.forecast = new ArrayList<ForecastFavoritesDto>();
	}

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public String getCityId() {
		return cityId;
	}

	public double getLat() {
		return lat;
	}

	public void setLat(double lat) {
		this.lat = lat;
	}

	public double getLng() {
		return lng;
	}

	public void setLng(double lng) {
		this.lng = lng;
	}

	public void setCityId(String cityId) {
		this.cityId = cityId;
	}

	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public String getUrl() {
		return url;
	}

	public void setUrl(String url) {
		this.url = url;
	}

	public int getPosition() {
		return position;
	}

	public void setPosition(int position) {
		this.position = position;
	}

	public boolean isVisible() {
		return visible;
	}

	public void setVisible(boolean visible) {
		this.visible = visible;
	}

	public String getConditionString() {
		return conditionString;
	}

	public void setConditionString(String conditionString) {
		this.conditionString = conditionString;
	}

	public int getTemperature() {
		return temperature;
	}

	public void setTemperature(int temperature) {
		this.temperature = temperature;
	}

	public String getHumidity() {
		return humidity;
	}

	public void setHumidity(String humidity) {
		this.humidity = humidity;
	}

	public String getIconUrl() {
		return iconUrl;
	}

	public void setIconUrl(String iconUrl) {
		this.iconUrl = iconUrl;
	}

	public String getWindDirection() {
		return windDirection;
	}

	public void setWindDirection(String windDirection) {
		this.windDirection = windDirection;
	}

	public int getWindSpeed() {
		return windSpeed;
	}

	public void setWindSpeed(int windSpeed) {
		this.windSpeed = windSpeed;
	}

	public String getWindSpeedUnit() {
		return windSpeedUnit;
	}

	public void setWindSpeedUnit(String windSpeedUnit) {
		this.windSpeedUnit = windSpeedUnit;
	}

	public String getBackgroundImageUrl() {
		return backgroundImageUrl;
	}

	public void setBackgroundImageUrl(String backgroundImageUrl) {
		this.backgroundImageUrl = backgroundImageUrl;
	}

	public List<ForecastFavoritesDto> getForecastList() {
		return forecast;
	}

	public void setForecast(List<ForecastFavoritesDto> forecast) {
		this.forecast = forecast;
	}

	public ForecastFavoritesDto getForecast(int index) {
		return forecast.get(index);
	}

	public boolean addForecast(ForecastFavoritesDto forecast) {
		return this.forecast.add(forecast);
	}

	public static String getCreateQuery() {
		return "CREATE TABLE meteo (" + "id INTEGER PRIMARY KEY AUTOINCREMENT, " + "cityId TEXT, " + "title TEXT, " + "conditionString TEXT, "
				+ "humidity TEXT, " + "iconUrl TEXT, " + "windDirection TEXT, " + "windSpeedUnit TEXT, " + "backgroundImageUrl TEXT, " + "position INTEGER, "
				+ "temperature INTEGER, " + "windSpeed INTEGER, " + "visible BOOLEAN NOT NULL, " + "url TEXT);";
	}

	@Override
	public boolean isValid() {
		// TODO Auto-generated method stub
		return false;
	}

}
